package com.ithei.多线程第二天.生产者和消费者;

import sun.security.krb5.internal.crypto.Des;

public class Foodie extends Thread {
    @Override
    public void run() {
        while (true) {
            synchronized (Desk.lock) {
                if (Desk.count == 0) {
                    break;
                } else {
                    if (Desk.flag) {
                        System.out.println("吃货消费者在eat........");
                        Desk.count--;
                        Desk.flag = false;
                        Desk.lock.notifyAll();
                    }
                    try {
                        Desk.lock.wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
